package com.example.blogdesign.Controller;



import com.example.blogdesign.Service.IFollowService;
import com.example.blogdesign.dto.Result;
import com.example.blogdesign.dto.UserDTO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private IFollowService followService;

    @PutMapping("/{id}/{isFollow}")
    public Result<?> followOrNot(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow){
        return followService.followOrNot(followUserId,isFollow);
    }

    @GetMapping("or/not/{id}")
    public Result<Boolean> isFollow(@PathVariable("id") Long followUserId){
        return followService.isFollow(followUserId);
    }

    @GetMapping("/common/{id}")
    public Result<List<UserDTO>> commonFollow(@PathVariable("id") Long id) {
        return followService.commonFollow(id);
    }

}
